package com.teach.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.teach.entity.ShopAddress;
import com.teach.mapper.ShopAddressMapper;
import com.teach.service.shop.ShopAddressService;

@Service
public class ShopAddressServiceImpl implements ShopAddressService{

	@Autowired
	private ShopAddressMapper mapper;
	
	@Override
	public List<ShopAddress> get(String userName) {
		return mapper.selectByUserName(userName);
	}

	@Override
	public ShopAddress getMsg(Integer msg, String userName) {
		return mapper.selectByMsg(msg,userName);
	}
	
	@Override
	public int del(Integer addressId, String userName) {
		return mapper.deleteByAddressId(addressId, userName);
	}

	@Override
	public void delete(Integer shopAddressId) {
		mapper.deleteByPrimaryKey(shopAddressId);
	}

	@Override
	public void add(ShopAddress shopAddress) {
		mapper.insertSelective(shopAddress);
	}

	@Override
	public int updateMsg(Integer msg, Integer addressId) {
		return mapper.updateByMsg(msg, addressId);
	}

	@Override
	public ShopAddress select(Integer shopAddressId) {
		return mapper.selectByPrimaryKey(shopAddressId);
	}

	@Override
	public int update(String userName) {
		return mapper.update(userName);
	}

	@Override
	public int insert(String province, String city, String area, String posi, String pho, String rel, Integer msg,
			String userName) {
		return mapper.insertByAddressId(province, city, area, posi, pho, rel, msg, userName);
	}

}